﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
using WpfApp_Autofac.Base;
using WpfApp_Autofac.Bll;

namespace WpfApp_Autofac.ViewModels;

public class MainWindowViewModel
{
    public string? Title { get; set; }

    public IAuth? _Auth;

    public ICommand btnClassAopCommand { get; set; }

    public ICommand btnInterfaceAopCommand { get; set; }



    public MainWindowViewModel(IAuth auth)
    {
        this.Title = "我是通过Autofac注入对象！";

        btnClassAopCommand = new Command(BtnAopFunc);

        btnInterfaceAopCommand = new Command(BtnInterfaceAop);

        _Auth = auth;
    }


    public virtual void BtnAopFunc(object? arg)
    {
        Console.WriteLine("Autofac Aop");
    }

    public void BtnInterfaceAop(object? arg)
    {
        _Auth?.Login("tom","a");
    }
}
